﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once

#include "IExportCustomizer.h"

namespace gcmp
{
    class DefaultExportCustomizer : public IExportCustomizer//导出回调
    {
    public:
        virtual ExportMode GetExportMode(const IElement* pElement, IModelView* pModelView) const override { return ExportMode::DIRECT_EXPORT; }
        virtual void GetExportBlock(IModelView* pModelView, std::set<const IElement*>& exportElements, std::vector<ExportBlock>& exportBlocks)const override {}
        virtual std::wstring GetExportLayer(const IElement* pElement, IModelView* pModelView, const IGraphicsNodePath* pPath, const ExportNodeParameter& paramter) const override { return L"ModelLine"; }
        virtual std::wstring GetTextStyle(const IElement* pElement, IModelView* pModelView, const IGraphicsNodePath* pPath) const override { return L"simhei"; }
        virtual ExportRetreatType GetExportRetreatType(const IElement* pLowElement, const IElement* pHighElement, IModelView* pModelView) const { return EXPORT_HEIGHT_RETREAT; }
        virtual OwnerPtr<IHatchSettings> GetHatchSetting(const IElement* pElement, IModelView* pModelView, const IGraphicsNodePath* pPath, const IGraphicsStyleData* pStyleData, bool bSection, const IDocument* pStyleDoc) const { return nullptr; }
        virtual std::vector<OwnerPtr<ICADDimension>> GetExportDimensions(const IElement* pElement, IModelView* pModelView) const override { return std::vector<OwnerPtr<ICADDimension>>(); }
        virtual std::vector<gcmp::ElementId> GetMaskOrderFromBtmToTop(IModelView* pModelView) const override { return std::vector<gcmp::ElementId>(); }
        virtual bool IsExportPolyLine(const IElement* pElement, IModelView* pModelView, std::set<ElementId>& setRelatedId) const { return false; }
        virtual std::vector<std::vector<int>> GetExportPolyLines(IModelView* pModelView, const std::vector<CurveAndParameter>& curveAndParams) const { return std::vector<std::vector<int>>(); };
        virtual int GetLineWidthPixelMode(const IElement* pElement, const IGraphicsNode* pGraphicsNode, IModelView* pModelView) const override { return 1.0; }
        virtual void GetExportHiddenLineModeInViewport(bool& bExportHiddenLine, bool& bKeepHighHiddenLine, const IModelView* pMainView, const IModelView* pSubView) const {}
        virtual void GetExportColorByView(const IModelView* pModeView, const ILinkDocumentElement* pLinkDocument, bool& byView) const {}
        virtual void GetExportLineStyleByView(const IModelView* pModeView, const ILinkDocumentElement* pLinkDocument, bool& byView) const {}
        virtual LinkDocumentHLRMode GetLinkDocumentHLRMode(IModelView* pModelView) const { return LinkDocumentHLRMode::SameProfessional; }
        virtual bool GetInsertPoint(Vector2d& insertPoint, const IModelView* pModelView, const Box2d& box, int index, int nTotal) { return false; }
        virtual ExportRetreatType GetExportRetreatType(const ExportSourceData& lowElementData, const ExportSourceData& highElementData, IModelView* pModelView) const { return EXPORT_IGNORE; }
        virtual std::vector<unsigned int> GetExportDimensionAttachMarkers(const IElement* pElement, IModelView* pModelView, const std::vector<const IGraphicsNodePath*>& gNodePaths) const { return std::vector<unsigned int>(); }
    
        virtual double GetRichTextReplacedLineSpace(double old) const
        {
            if (MathUtils::IsEqual(old, 0.0)) return 1.0;
            return -1.0;
        }
        virtual bool CustomizeElementExportData(const IModelView* pModelView, const IElement* pElement, const IGraphicsElementShape* pElementShape, OwnerPtr<IGraphicsElementShape>& opNewElementShape) const
        {
            return false;
        }

        virtual std::wstring GetExportBlock(const IElement* pElement, IModelView* pModelView, const IDrawingViewport* pViewport, std::wstring& strLayerName, gcmp::BlockInsertPointType& insertPointType, gcmp::Vector3d& insertPoint) const override
        {
            return L"";
        }
        void GetExportImages(const IModelView* pModelView, const IDrawingViewport* pViewport, std::vector<ExportImageInfo>& exportImageInfos) const { }
    };
}